home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / readme.txt < prev    next >
Text File  |  1993-07-21  |  18KB  |  406 lines

  1. *************************************************************************
  2. *                                                                       *
  3. *  Compiler Construction Tool Box                                       *
  4. *  ==============================                                       *
  5. *                                                                       *
  6. *  Version 9208                                                         *
  7. *                                                                       *
  8. *  Copyright (c) 1989, 1990, 1991, 1992 by                              *
  9. *                                                                       *
  10. *  Gesellschaft fuer Mathematik und Datenverarbeitung                   *
  11. *  (German National Research Center for Computer Science)               *
  12. *  Forschungsstelle fuer Programmstrukturen                             *
  13. *  an der Universitaet Karlsruhe                                        *
  14. *                                                                       *
  15. *  All rights reserved. GMD assumes no responsibility for the use       *
  16. *  or reliability of its software.                                      *
  17. *                                                                       *
  18. *************************************************************************
  19.  
  20.  
  21. Direct requests, comments, questions, and error reports to:
  22.  
  23.    Josef Grosch
  24.    GMD Forschungsstelle
  25.    Vincenz-Priessnitz-Str. 1
  26.    D-7500 Karlsruhe 1
  27.    Phone: +721-662226
  28.    Email: grosch@karlsruhe.gmd.de
  29.  
  30.  
  31. Distribution Format:
  32. --------------------
  33.  
  34. The compiler construction tool box is distributed via anonymous ftp in
  35. compressed tar format or in plain tar format on the following media:
  36.  
  37. - DC300/600 data cartridge (streamer tape) 
  38. - TK 50
  39. - Exabyte
  40. - 1/2" magnetic tape (1600 bpi)
  41.  
  42. To read a tape use:
  43.  
  44.    tar -xvfb /dev/rst0 20  or  tar -xvb 20  or similar commands
  45.  
  46.  
  47. The directories and their contents are as follows:
  48. --------------------------------------------------
  49.  
  50. directory       contents
  51. ------------------------------------------------------------------------
  52. README          this file
  53. Makefile        compilation and installation of the tools
  54. doc.ps          documentation in postscript format
  55. doc.me          documentation in troff format, me macros
  56. man             manual pages  in troff format, man macros
  57. rex             Scanner Generator
  58. lalr            LALR(1) Parser Generator
  59. ell             LL(1) Recursive Descent Parser Generator
  60. bnf             Transforms Grammars from Extended BNF to Plain BNF
  61. front           Common Front-End of Lalr, Ell, and Bnf
  62. reuse           Library of Reusable Modules
  63. common          Library for estra and ell
  64. specs           Example Specifications for the Above Tools
  65. cg              Common Program implementing Ast and Ag
  66.                 Ast = Generator for Abstract Syntax Trees
  67.                 Ag  = Attribute Evaluator Generator
  68. puma            Transformation Tool based on Pattern Matching
  69. l2r             Transforms Lex  input to Rex  input
  70. y2l             Transforms Yacc input to Lalr input
  71. r2l             Transforms Rex  input to Lex  input
  72. rpp             Rex PreProcessor: rpp + cg extract most of a scanner
  73.                 specification out of a parser specification
  74. estra           Transformation of attributed trees (prototype)
  75. hexa            contains the scanner and parser tables of Rex and Front
  76.                 (= front-end of Lalr and Bnf) converted from binary to
  77.                 ascii hexadecimal representation
  78. bin             shell scripts (my version)
  79. lib             executables, table and data files (for SUN 3/SunOS 4.0)
  80. (mtc            Modula-2 to C translator)
  81.  
  82. The names of the subdirectories indicate the following types of information:
  83.  
  84. sub directory   contents
  85. ------------------------------------------------------------------------
  86. src             source files in Modula-2
  87. m2c             source files in C (generated from the Modula-2 sources)
  88. c               source files in C (hand-written)
  89. lib             data files, module skeletons
  90. test            test environment for a tool
  91.  
  92.  
  93. Documentation:
  94. --------------
  95.  
  96. The directories doc.ps and doc.me contain documentation in postscript format
  97. and in troff format (me macros). The document entitled "Toolbox Introduction"
  98. in the files intro.ps or intro.me gives an overview and introduces into the
  99. toolbox. It should be read first. The following documents are available:
  100.  
  101. Filename        Title
  102. ------------------------------------------------------------------------
  103. intro           Toolbox Introduction
  104. toolbox         A Tool Box for Compiler Construction
  105. werkzeuge       Werkzeuge fu"r den U"bersetzerbau
  106. reuse           Reusable Software - A Collection of Modula-2-Modules
  107. prepro          Preprocessors
  108. rex             Rex - A Scanner Generator
  109. scanex          Selected Examples of Scanner Specifications
  110. scangen         Efficient Generation of Table-Driven Scanners
  111. lalr-ell        The Parser Generators Lalr and Ell
  112. lalr            Lalr - A Generator for Efficient Parsers
  113. ell             Efficient and Comfortable Error Recovery in Recursive
  114.                    Descent Parsers
  115. highspeed       Generators for High-Speed Front-Ends
  116. autogen         Automatische Generierung effizienter Compiler
  117. ast             Ast - A Generator for Abstract Syntax Trees
  118. toolsupp        Tool Support for Data Structures
  119. ag              Ag - An Attribute Evaluator Generator
  120. ooags           Object-Oriented Attribute Grammars
  121. estra           Spezifikation und Implementierung der Transformation
  122.                    attributierter Ba"ume
  123. puma            Puma - A Generator for the Transformation of Attributed Trees
  124. trafo           Transformation of Attributed Trees Using Pattern Matching
  125. (minilax        Specification of a MiniLAX-Interpreter)
  126. (begmanual      BEG - a Back End Generator - User Manual)
  127.  
  128.  
  129. References:
  130. -----------
  131.  
  132. 1.   J. Grosch, `Generators  for  High-Speed  Front-Ends',  LNCS,
  133.      371, 81-92 (Oct. 1988), Springer Verlag.
  134.  
  135. 2.   H. Emmelmann, F. W. Schroeer, Rudolf Landwehr, ` BEG - a Generator
  136.      for Efficient Back Ends', Sigplan Notices, 24, 227-237 (Jul. 1989)
  137.  
  138. 3.   W. M. Waite, J. Grosch and F. W.  Schroeer,  `Three  Compiler
  139.      Specifications', GMD-Studie Nr. 166, GMD Forschungsstelle an
  140.      der Universitaet Karlsruhe, Aug. 1989.
  141.  
  142. 4.   J. Grosch,  `Efficient  Generation  of  Lexical  Analysers',
  143.      Software-Practice & Experience, 19, 1089-1103 (Nov. 1989).
  144.  
  145. 5.   J. Grosch, `Efficient and Comfortable Error Recovery in Recursive
  146.      Descent Parsers', Structured Programming, 11, 129-140 (1990).
  147.  
  148. 6.   J. Grosch, H. Emmelmann, `A Tool Box for Compiler Construction',
  149.      LNCS, 477, 106-116 (Oct. 1990), Springer Verlag.
  150.  
  151. 7.   J. Grosch, `Object-Oriented Attribute Grammars', in: Proceedings of the
  152.      Fifth International Symposium on Computer and Information Sciences (ISCIS V)
  153.      (Eds. A. E. Harmanci, E. Gelenbe), Cappadocia, Nevsehir, Turkey, 807-816,
  154.      (Oct. 1990).
  155.  
  156. 8.   J. Grosch,  `Lalr - a Generator for Efficient Parsers',
  157.      Software-Practice & Experience, 20, 1115-1135 (Nov. 1990).
  158.  
  159. 9.   J. Grosch, `Tool Support for Data Structures',
  160.      Structured Programming, 12, 31-38 (1991).
  161.  
  162.  
  163. Machine Dependencies:
  164. ---------------------
  165.  
  166. All machine dependent code is isolated in the file System.c which is written
  167. in C. This file is set up to work under UNIX. There are three copies of this
  168. file in the following directories:
  169.  
  170.    reuse/c
  171.    reuse/src
  172.    reuse/m2c
  173.  
  174. The UNIX command 'install' is used during installation. Unfortunately, this
  175. command is not as standard as it should be. If 'install' is missing on your
  176. machine or it complains about the calls then the shell script in the file
  177. hexa/install can simulate the desired behaviour.
  178.  
  179.  
  180. Installation:
  181. -------------
  182.  
  183. The Makefile at the global level controls the compilation and installation
  184. of the individual tools. It activates the tool specific Makefiles.
  185.  
  186. Several tools use binary data files called Scan.Tab and Pars.Tab whose internal
  187. representation depends on whether the machine is little-endian or big-endian.
  188. All machines store integer numbers in a sequence of bytes with increasing adresses.
  189. An integer number usually consists of four bytes where the bytes at both ends are
  190. termed most significat byte (MSB) and least significant byte (LSB). Big-endian
  191. machines store the MSB at the lowest address and the LSB at the highest address.
  192. Little-endian machines store the bytes the other way round.
  193. Big-endian are e. g. MC 680x0, SUN/3, SUN/4, SPARC,
  194. little-endian are e. g. VAX, DEC Station.
  195.  
  196. Initially the binary data files are configured for big-endian machines.
  197. To find out in which class your machine is in execute:
  198.  
  199.    make endian
  200.  
  201. To convert the binary files from big-endian to little-endian or vice versa execute:
  202.  
  203.    make bin.conv
  204.  
  205. Edit the first couple of lines in the Makefile to accomodate your needs.
  206. To compile the programs execute:
  207.  
  208.    make
  209.  
  210. To install the programs execute:
  211.  
  212.    make install
  213.  
  214.  
  215. Recent Changes
  216. --------------
  217.  
  218. Version 9208:
  219.  
  220. - The scanner generator 'rex' and the parser generators 'lalr' and 'ell'
  221.   allow to chose arbitrary names for the generated modules. Therefore, it is
  222.   possible to have several scanners and parsers in one program.
  223.  
  224. - The length of a token and the lookahead in scanners generated by 'rex' is no
  225.   longer restricted to 256 characters. Both, tokens and lookahead can be of
  226.   arbitrary length. A restriction in the size of the tables generated by 'lalr'
  227.   has been removed. Now it is possible to generate rather huge parsers.
  228.  
  229. - The attribute grammar tool 'ag' has been extended to generate attribute
  230.   evaluators for well-defined attribute grammars (WAGs). The program checks
  231.   grammars whether they obey this property. It is possible to access
  232.   non-local attributes and to compute attributes on a restricted form of
  233.   graphs.
  234.  
  235. - The auxiliary modules 'Errors' and 'Source' have been included into the
  236.   library of reusable modules called 'reuse'. The 'Errors' module has been
  237.   extended to support messages with a string argument. It allows to store
  238.   the messages and print them sorted by the source position. An extra module
  239.   named 'Positions' has been introduced in 'reuse', too, for the handling of
  240.   source positions.
  241.  
  242. - The program 'cg' which implements 'ast' and 'ag' accepts several input files.
  243.   Instead of one file that communicates a tree definition to 'puma' with the
  244.   fixed name 'TREE.TS' it is possible to produce several of those with different
  245.   names. This is of interest if different "views" have to be communicated.
  246.  
  247. - The extern declarations for malloc, free, and exit have been removed from
  248.   the generated C code.
  249.  
  250. - All tools do not generate # line directives by default, only upon request.
  251.  
  252. - In case of fatal errors during the execution of generated modules a user
  253.   defined exception routine can be called instead of the predefined 'exit (1)'.
  254.  
  255. Version 9202:
  256.  
  257. - The Toolbox contains a new tool for the transformation of attributed trees
  258.   called 'puma'. It is based on pattern-matching. It replaces its predecessor
  259.   'estra' and comes with documentation in English.
  260.  
  261. - The tool for abstract syntax trees 'ast' has been extended from single to
  262.   multiple inheritance. So-called "subunits" allow the implementation of one
  263.   abstract tree by several compilation units. The concept of "views" makes
  264.   it possible to derive from a common specification several abstract syntax
  265.   trees which represent subsets.
  266.  
  267. - The attribute grammar tool 'ag' has analogously been extended to process
  268.   object-oriented attribute grammars with multiple inheritance. It supports the
  269.   generation of several attribute evaluators that run one after the other.
  270.  
  271. - The error handling module for the parser generators 'lalr' and 'ell' are
  272.   independent of the parser module or the grammar. The manual for these parser
  273.   generators has been completely rewritten.
  274.  
  275. - The Modula-2 to C translator 'mtc' has a new code-generator. This brings
  276.   big efficiency improvements: 30% smaller program, 10% faster, 75% less
  277.   dynamic memory consumption. It generates ANSI C as well as K&R C.
  278.   
  279. - The sources of all tools are in ANSI C as well as in K&R C.
  280.  
  281. - All tools generate modules in the target languages C (ANSI + K&R), C++,
  282.   and Modula-2.
  283.  
  284. - The interface to the operating system has been redesigned. It allows to
  285.   switch IO operations between UNIX system calls and C library calls.
  286.   This should assure much better portability.
  287.   
  288.  
  289.  
  290.               Compiler Construction Tool Box
  291.               ==============================
  292.  
  293.      Rex (Regular EXpression tool) is a scanner  generator  whose
  294. specifications  are  based  on  regular expressions and arbitrary
  295. semantic actions written in one of  the  target  languages  C  or
  296. Modula-2.  As  scanners sometimes have to consider the context to
  297. unambiguously recognize a token the right context can  be  speci-
  298. fied by an additional regular expression and the left context can
  299. be handled by so-called  start  states.  The  generated  scanners
  300. automatically  compute the line and column position of the tokens
  301. and offer an efficient mechanism  to  normalize  identifiers  and
  302. keywords  to upper or lower case letters. The scanners are table-
  303. driven and run at a speed of 180,000 to 195,000 lines per  minute
  304. on a MC 68020 processor.
  305.  
  306.      Lalr is a LALR(1) parser generator accepting grammars  writ-
  307. ten  in  extended BNF notation which may be augmented by semantic
  308. actions expressed by statements of the target language. The  gen-
  309. erator  provides  a  mechanism  for  S-attribution,  that is syn-
  310. thesized attributes can be computed during parsing.  In  case  of
  311. LR-conflicts  unlike  other tools Lalr provides not only informa-
  312. tion about an internal state consisting of a set of items but  it
  313. prints a derivation tree which is much more useful to analyze the
  314. problem. Conflicts can be resolved by specifying  precedence  and
  315. associativity of operators and productions. The generated parsers
  316. include automatic  error  recovery,  error  messages,  and  error
  317. repair.  The  parsers  are  table-driven  and  run  at a speed of
  318. 560,000 lines per minute. Currently parsers can be  generated  in
  319. the target languages C and Modula-2.
  320.  
  321.      Ell is a LL(1) parser generator accepting the same  specifi-
  322. cation  language  as  Lalr except that the grammars must obey the
  323. LL(1) property. It  is  possible  to  evaluate  an  L-attribution
  324. during parsing. The generated  parsers  include  automatic  error
  325. recovery,  error  messages,  and  error  repair  like  Lalr.  The
  326. parsers are implemented following the  recursive  descent  method
  327. and  reach a speed of 810,000 lines per minute. The possible tar-
  328. get languages are again C and Modula-2.
  329.  
  330. Ast - A Generator for Abstract Syntax Trees
  331.  
  332. - generates abstract data types (program modules) to handle trees
  333. - the trees may be attributed
  334. - besides trees graphs are handled as well
  335. - nodes may be associated with arbitrary many attributes of arbitrary type
  336. - specifications are based on extended context-free grammars
  337. - common notation for concrete and abstract syntax
  338. - as well as for attributed trees and graphs
  339. - an extension mechanism provides single inheritance
  340. - trees are stored as linked records
  341. - generates efficient program modules
  342. - generates modules in Modula-2 or C
  343. - provides many tree operations (procedures):
  344. - node constructors combine aggregate notation and storage management
  345. - ascii graph reader and writer
  346. - binary graph reader and writer
  347. - reversal of lists
  348. - top down and bottom up traversal
  349. - interactive graph browser
  350.  
  351. Ag - An Attribute Evaluator Generator
  352.  
  353. - processes ordered attribute grammars (OAGs)
  354. - processes higher order attribute grammars (HAGs)
  355. - operates on abstract syntax
  356. - is based on tree modules generated by Ast
  357. - the tree structure is fully known
  358. - terminals and nonterminals may have arbitrary many attributes
  359. - attributes can have any target language type
  360. - allows tree-valued attributes
  361. - differentiates input and output attributes
  362. - allows attributes local to rules
  363. - allows to eliminate chain rules
  364. - offers an extension mechanism (single inheritance)
  365. - attributes are denoted by unique selector names
  366.    instead of nonterminal names with subscripts
  367. - attribute computations are expressed in the target language
  368. - attribute computations are written in a functional style
  369. - attribute computations can call external functions
  370. - non-functional statements and side-effects are possible
  371. - allows to write compact, modular, and readable specifications
  372. - AGs can consist of several modules
  373. - the context-free grammar is specified only once
  374. - checks an AG for completeness of the attribute computations
  375. - checks for unused attributes
  376. - checks an AG for the classes SNC, DNC, OAG, LAG, and SAG
  377. - the evaluators are directly coded using recursive procedures
  378. - generates efficient evaluators
  379. - generates evaluators in Modula-2 (or C)
  380.  
  381. Puma - Transformation Tool based on Pattern Matching
  382.  
  383. - last but not least
  384.  
  385.  
  386. A comparison of the above tools with the corresponding UNIX
  387. tools shows that significant improvements in terms of error handling
  388. as well as efficiency have been achieved:
  389. Rex generated scanners are 4 times faster than those of LEX.
  390. Lalr generated parsers are 2-3 times faster than those of YACC.
  391. Ell generated parsers are 4 times faster than those of YACC.
  392. The input languages of the tools are improvements of the LEX and YACC
  393. inputs. The tools also understand LEX and YACC syntax with the help of
  394. the preprocessors l2r and y2l.
  395.  
  396. The tool box is publicly copyable. It has been developed since 1987.
  397. It has been tested by generating scanners and parsers for
  398. e. g. Pascal, Modula, Oberon, Ada and found stable.
  399.  
  400. The tool box is implemented in Modula-2. It has been developed using our
  401. own Modula-2 compiler called MOCKA on a MC 68020 based UNIX workstation.
  402. It has been ported to the SUN workstation and been compiled successfully
  403. using the SUN Modula-2 compiler. The tools also run on VAX/BSD UNIX and
  404. VAX/ULTRIX machines. This should assure a reasonable level of portability
  405. for the Modula-2 code. Meanwhile the sources exist in C, too.
  406.